/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t_rtp_session_destroy.c                           */
/*  NOTE      =                                                    */
/*  DATE      = 2016/02/17 by songbb                               */
/*******************************************************************/

#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"

#include "../../../src/module/rtp/config.h"
#include "../test_rtp_comm.h"
#include <rtp/rtp_core.h>
#include <rtp/rtp_header.h>
#include <rtp/rtp_comm.h>
#include <frct_comm.h>
#include <apmtest_comm.h>

extern int __rtp_private_session_init(L7_session *p_st_session);

static int __suite_init(void)
{
    return 0;
}

static int __suite_cleanup(void)
{
    return 0;
}

static void __case1(void)
{
    L7_session *p_st_session = NULL;
    p_st_session = (L7_session *) frmalloc(sizeof(L7_session));
    CU_ASSERT_PTR_NOT_NULL(p_st_session);
    memset(p_st_session, 0x00, sizeof(L7_session));

    CU_ASSERT_EQUAL(__rtp_private_session_init(p_st_session), FR_SUCC);

    rtp_session_destory(p_st_session->p_session_private);
    apmtest_free((void **) &p_st_session->p_username);
    apmtest_free((void **) &p_st_session);
}

int add_suite_rtp_session_destroy(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" rtp_session_destroy()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    if (CU_add_test(pSuite, "case1", __case1) == NULL)
        return FR_FAIL;

    return FR_SUCC;
}
